<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">  
	<title>视频管理</title>
</head>
<body>
 <?php
  require_once('inc_admin.php');
  require_once('menu.php'); 
  connect();
  $sql = 'select videos.*,videotype.typename from videos left join videotype on videos.tid=videotype.tid';
  $result = fetch_array($sql); 
  //根据字符串的到关联数组或数字数组
 ?>
 <center><h2>视频管理</h2></center>
 <table align="center" width="80%" border=1> 
 <tr>
	<th>视频ID</th>
	<th>视频名称</th>
	<th>视频类型</th>
	<th>海报</th>
	<th>内容简介</th>
	<th>添加日期</th>
	<th>上传用户</th>
	<th>点击率</th>
	<th>下载量</th>
	<th>下载地址</th>
	<th>操作</th>
 </tr>

<?php 
	foreach($result as $one) 
	{
		echo '<tr>';
		echo '<td>'.$one['vid'].'</td>';
		echo '<td>'.$one['videoname'].'</td>';
		echo '<td>'.$one['tid'].'</td>';
		echo '<td>'.$one['pic'].'</td>';
		echo '<td>'.$one['intro'].'</td>';
		echo '<td>'.$one['uploaddate'].'</td>';
		echo '<td>'.$one['uploadadmin'].'</td>';
		echo '<td>'.$one['hittimes'].'</td>';
		echo '<td>'.$one['downtimes'].'</td>';
		echo '<td>'.$one['address'].'</td>';
		echo '<td>
		<a href="videoForm.html">添加</a>|
		<a href="videoEditForm.php? id='.$one['vid'].' ">修改</a>| 
		<a href="videoDelete.php? id='.$one['vid'].'" onClick="return confirm(\'确定要删除吗？\');">删除</a>
		 </td>';
		 //onClick:当点击按钮时执行一段 JavaScript：如果不加return 会导致直接确定，不会有取消按键
		echo '</tr>';
	}
 ?>
</body>
</html>
